import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "login",
      component: () => import("../views/login/index.vue"),
    },
    {
      path: "/test",
      name: "test",
      component: () => import("../views/test.vue"),
    },
    {
      path: "/home",
      name: "home",
      component: () => import("../views/home/index.vue"),
      redirect: "/home/soft",
      children: [
        {
          path: "/home/soft",
          component: () => import("../views/home/soft/soft.vue"),
        },
        {
          path: "/home/pc",
          component: () => import("../views/home/pc/index.vue"),
        },
        {
          path: "/home/pe",
          component: () => import("../views/home/pe/index.vue"),
        },
      ],
    },
    {
      path: "/main",
      name: "main",
      component: () => import("../views/main/index.vue"),
      redirect: "/main/dxTab",
      children: [
        {
          path: "/main/dxTab",
          component: () => import("../components/dx-tab.vue"),
        },
        {
          path: "/main/source",
          component: () => import("../views/source/index.vue"),
        },
      ],
    },
    {
      path: "/index",
      component: () => import("../views/home/index/index.vue"),
      redirect: "/index/soft",
      children: [
        {
          path: "/index/soft",
          component: () => import("../views/home/index/soft/index.vue"),
        },
        {
          path: "/index/detail",
          component: () => import("../views/home/index/soft/detail.vue"),
        },
      ],
    },
    {
      path: "/videos",
      name: "videos",
      component: () => import("@/views/home/index/videos/index.vue"),
    },
    {
      path: "/books",
      name: "books",
      component: () => import("@/views/home/index/books/index.vue"),
      children: [
        {
          path: "/books/detail",
          component: () => import("../views/home/index/books/detail.vue"),
        },
        {
          path: "/books/list",
          component: () => import("../views/home/index/books/list.vue"),
        },
      ],
    },
    {
      path: "/source",
      name: "source",
      component: () => import("@/views/home/index/source/index.vue"),
    },
    { path: "/:pathMatch(.*)*", name: "NotFound" },
  ],
});

export default router;
